import { _decorator, Component, Node, tween, Vec3 } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('BtnAnimation')
export class BtnAnimation extends Component {
    start() {
        let maxX = this.node.scale.x;
        let maxY = this.node.scale.y;
        this.node.on(Node.EventType.TOUCH_START,() =>{
            tween(this.node)
            .to(0.1,{scale: new Vec3(maxX, maxY, 1)})
            .to(0.1,{scale: new Vec3(maxX * 0.85, maxY * 0.85, 1)})
            .to(0.1,{scale: new Vec3(maxX * 1.15, maxY * 1.15, 1)})
            .to(0.1,{scale: new Vec3(maxX *0.95, maxY * 0.95, 1)})
            .to(0.1,{scale: new Vec3(maxX, maxY, 1)})
            .start()
        })
    //     tween(this.node)
    // .to(1, { 
    //     position: new Vec3(0, 10, 0),                   // 位置缓动
    //     scale: new Vec3(1.2, 3, 1),                     // 缩放缓动
    //     rotation:quat }                                 // 旋转缓动
    // )                                   
    // .start();
    }

    update(deltaTime: number) {
        
    }
}

